Sweep project records orphaned by failed index rollback (#141)#154
Sweep project records orphaned by failed index rollback (#141)#154alex-rawlings-yyc wants to merge 3 commits into
Conversation
|
Warning Review limit reached
Next review available in: 8 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
7a532c4 to
4a6a40c
Compare
createProject writes project:{id} before adding it to the projectIds
index, and rolls the record back if the index write fails. If that
rollback delete also fails, the record was orphaned forever — never
listed, never deleted, pure storage bloat.
The PAPI storage API exposes only read/write/delete with no key
enumeration, so reconciling live keys against the index isn't possible.
Instead, record the orphaned id in a persistent pendingCleanup set on
rollback failure, and retry the deletion opportunistically on the next
activation via a fire-and-forget sweep.
- Add pendingCleanup storage key with its own serialization queue so
recording an orphan and sweeping can't clobber each other's writes.
- recordPendingCleanup: idempotently add an orphan id; a failure to
record is logged and swallowed so it never masks the original index
error the caller must see.
- sweepPendingCleanup: retry each recorded delete (ENOENT = already
gone = success), clear cleaned ids, retain ids that fail again.
- Run the sweep at activation, fire-and-forget: a cleanup failure never
blocks activation and it retries on the next run.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Skip (and drop) pending-cleanup ids still in the index so a misrecorded live project's record is never deleted, and tolerate a corrupt pendingCleanup value instead of wedging the sweep on every activation. Dedup the queue/read helpers.
4a6a40c to
1383522
Compare
A corrupt pendingCleanup value was recovered as empty but the sweep's empty-set early return skipped the rewrite, so the bad value survived and re-warned on every launch. Report corruption from readPendingCleanup and overwrite the key with [] when nothing is left to sweep.
createProject writes project:{id} before adding it to the projectIds index, and rolls the record back if the index write fails. If that rollback delete also fails, the record was orphaned forever — never listed, never deleted, pure storage bloat.
The PAPI storage API exposes only read/write/delete with no key enumeration, so reconciling live keys against the index isn't possible. Instead, record the orphaned id in a persistent pendingCleanup set on rollback failure, and retry the deletion opportunistically on the next activation via a fire-and-forget sweep.
Devin: https://app.devin.ai/review/sillsdev/interlinearizer-extension/pull/154
This change is